-
-
Notifications
You must be signed in to change notification settings - Fork 32.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[theme] Improve default primary
, secondary
and error
theme palette
#26555
Conversation
…ial-ui into new-default-theme-color
Is it closing #18776 too? |
Great, 👍 |
…ial-ui into new-default-theme-color
@@ -4,6 +4,8 @@ import { expect } from 'chai'; | |||
import { createMount, describeConformanceV5, act, createClientRender } from 'test/utils'; | |||
import FormLabel, { formLabelClasses as classes } from '@material-ui/core/FormLabel'; | |||
import FormControl, { useFormControl } from '@material-ui/core/FormControl'; | |||
import { hexToRgb } from '@material-ui/core/styles'; | |||
import defaultTheme from '../styles/defaultTheme'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
use defaultTheme
here to remove hard coded color in the test below.
I wonder should defaultTheme
be exported as defaultLightTheme
from @material-ui/core/styles
also?
In my side project I use defaultTheme
a lot and it is quite annoying to call createTheme()
everytime.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The goal of this PR is to have default color palette that pass AA standard for both light & dark theme.
Was this not the case before? Listing these instances in a single place might be interesting for people that manually patched them for this purpose. Sounds like they can now remove code only targetted at patching AA ratio.
Github will only close one of them. Each referenced issue/pr needs to have its own magic keyword associated
'falls below the WCAG recommended absolute minimum contrast ratio of 3:1', // warning palette | ||
'falls below the WCAG recommended absolute minimum contrast ratio of 3:1', // info palette | ||
'falls below the WCAG recommended absolute minimum contrast ratio of 3:1', // success palette |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we include the color in the warning? If not then we can follow-up. Otherwise I'd make sure the color is included in the assertion which means we can get rid of the (potentially wrong) code comments.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
2 lines was there at the beginning (1 more is added because info
is changed to cyan[500]
, it's sound intentional that we expect the colors to falls below contrast ratio. I was confused at first about this test so I added comments at the end. Any suggestion?
If you mean #26541, it is related but different. This PR fix the default color from the theme where as #26541 remove custom color in the docs.
You mean add to documentation? |
No, I mean the direct thing I responded to:
In which instances did we not pass AA?
In the PR in a prominent spot so that you don't have to read through unrelated conversations to figure out what changed. |
Updated the description
|
primary
, secondary
and error
theme paletteprimary
, secondary
and error
theme palette
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm updating the PR's description, it fixes #26288 too. Regarding the contrast issue with error. See below, top down:
- Colors used in MD guidelines videos
- Colors used in the previous version on material design web components
- Our new color
primary
, secondary
and error
theme paletteprimary
, secondary
and error
theme palette
@michaldudak updated! 👍 |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
in mui/material-ui#21514 pseudo classes were moved from root to content, so we no longer need nested selectors and rules need to go on content directly use Mui-focused instead of :focus also restore muiv4 treeitem label color rule to get a different color right after a click on an item. It was also removed in treeitem in mui/material-ui#21514 Note: in v5 primary.main was changed from indigo to blue in mui/material-ui#26555) but let's go with the new primary colors Note2: fade renamed to alpha
After a quick look, we didn' customize TreeViewFinder which also uses TreeView/TreeItem so it shouldn't need the same fixing as ReportViewer. in mui/material-ui#21514 pseudo classes were moved from root to content, so we no longer need nested selectors and rules need to go on content directly use Mui-focused instead of :focus also restore muiv4 treeitem label color rule to get a different color right after a click on an item. It was also removed in treeitem in mui/material-ui#21514 Note: in v5 primary.main was changed from indigo to blue in mui/material-ui#26555) but let's go with the new primary colors Note2: fade renamed to alpha
After a quick look, we didn' customize TreeViewFinder which also uses TreeView/TreeItem so it shouldn't need the same fixing as ReportViewer. in mui/material-ui#21514 pseudo classes were moved from root to content, so we no longer need nested selectors and rules need to go on content directly use Mui-focused instead of :focus also restore muiv4 treeitem label color rule to get a different color right after a click on an item. It was also removed in treeitem in mui/material-ui#21514 Note: in v5 primary.main was changed from indigo to blue in mui/material-ui#26555) but let's go with the new primary colors Note2: fade renamed to alpha Co-authored-by: Sylvain Bouzols <sylvain.bouzols@gmail.com>
follow up from #26541
close #18378: dark mode following the spec
close #18776: dark mode color contrast
closes #26288: error color contrast in light mode
https://deploy-preview-26555--material-ui.netlify.app/
The goal of this PR is to have default color palette that pass AA standard for both light & dark theme. From the outcome of #26541, it is not possible to have one color that pass AA standard for both light & dark theme. So the color must be different between mode (same shade but different lightness)
https://material.io/design/color/dark-theme.html#ui-application
Primary color
V4 ❗️
indigo[500]
in default theme does not pass standard in dark modeV5 ✅
blue[700]
so that the docs does not change much and the logo looks consistent.primary.dark
andprimary.light
close to the docsSecondary color
V4 ❗️
pink.A400
in default theme does not pass standard in light & dark modeV5 ✅
purple[500]
because the docs usedpink.A400
which does not pass AA standard and the color is too close toerror
. As far as I tried, I feel purple sit very well with the primary (blue) color.purple[200]
in dark mode similar to primary colorError color
V4 ❗️
red[500]
does not pass standard in light modeV5 ✅
red[700]
in light modeInfo color
cyan[500]
(it wasblue[500]
in v4) to not use the same color as v5 primary color and still informative color.warning and success remains the same.
Preview of some components